package com.zxu.test.start;

import android.view.View;

import androidx.databinding.ObservableField;
import androidx.lifecycle.MutableLiveData;

import com.zxu.test.base.BaseViewModel;
import com.zxu.test.studyapp.R;
import com.zxu.test.util.DoubleClickUtils;
import com.zxu.test.util.Event;

public class SplashViewModel extends BaseViewModel {

    public final ObservableField<Event<String>> btnEvent = new ObservableField<>();
    public final ObservableField<Event<String>> tryEvent = new ObservableField<>();
    public final ObservableField<Event<String>> gravEvent = new ObservableField<>();
    public final ObservableField<Event<String>> clientEvent = new ObservableField<>();
    private final  MutableLiveData<Event<Object>> btBroadcastEvent = new MutableLiveData<>();

    MutableLiveData<Event<Object>> getBroadcastCommand() {
        return btBroadcastEvent;
    }

    public SplashViewModel() {
        start();
    }

    private void start() {
    }

    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.bt:
                if (!DoubleClickUtils.isFastDoubleClick(R.id.bt))
                    btnEvent.set(new Event<>(""));
                break;
            case R.id.btTry:
                if (!DoubleClickUtils.isFastDoubleClick(R.id.btTry))
                    tryEvent.set(new Event<>(""));
                break;
            case R.id.btBroadcast:
                if (!DoubleClickUtils.isFastDoubleClick(R.id.btBroadcast))
                    btBroadcastEvent.setValue(new Event<>(""));
                break;
            case R.id.btGrav:
                if (!DoubleClickUtils.isFastDoubleClick(R.id.btGrav))
                    gravEvent.set(new Event<>(""));
                break;
            case R.id.btClient:
                if (!DoubleClickUtils.isFastDoubleClick(R.id.btClient))
                    clientEvent.set(new Event<>(""));
                break;

        }
    }

}
